package com.woniuxy.stage3demo.mapper.mappercai;

import com.woniuxy.stage3demo.bean.caicai.UserBean;
import com.woniuxy.stage3demo.bean.caicai.UserInfoBean;
import com.woniuxy.stage3demo.bean.caicai.dto.UserBeanDTO;
import com.woniuxy.stage3demo.bean.caicai.vo.UserVO;
import com.woniuxy.stage3demo.bean.hpxbean.OrderBean;
import com.woniuxy.stage3demo.pageHelper.PageRequest;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface UserMapper {
    /**
     * 用户列表的搜索查询
     * @param userBean
     * @return
     */
     List<UserVO> findBySearch(@Param("p") PageRequest request, @Param("u") UserBeanDTO userBean) ;

    /**
     * 根据Id查询用户的基本信息
     * @param id
     * @return
     */


    @Results({
            @Result(id=true,property = "id",column = "id",javaType = Long.class),
            @Result(property="userName" ,column="user_name", javaType=String.class),
            @Result(property="userLevel", column="user_level", javaType=Integer.class),
            @Result(property="attStatus", column="att_status", javaType=Integer.class),
            @Result(property="job" ,column="user_job", javaType=String.class),
            @Result(property="nockname", column="nockname", javaType=String.class),
            @Result(property="gender", column="gender", javaType=Integer.class),
            @Result(property="birthday", column="birthday", javaType=java.util.Date.class),
            @Result(property="reateTime", column="reate_time", javaType=java.util.Date.class),
            @Result(property="inviteUser", column="invite_user", javaType=Integer.class),
            @Result(property="delFlag", column="del_flag", javaType=Integer.class),
            @Result(property="status" ,column="status", javaType=Integer.class),
            @Result(property="bsdUser" ,column="bsd_user", javaType=Integer.class),
    })

        //最后查询用户的信息

    UserBean findUserById(@Param("id")long id);

    UserBean findUserById2(@Param("id")long id);

    UserBean findUserById3(@Param("id")long id);

    //根据id和用户状态 改变用户的状态
    int updateUserStatus(@Param("opt") int opt,@Param("id") Long id);

    //根据用户的id删除用户
    int delUser(@Param("id")long id);

    /**
     * 查询用户，配偶，担保人真实信息
     * @param
     * @return
     */

    UserInfoBean findUserInfo(@Param("id")long id);

    /**
     * 根据用户的id查询订单
     * @param
     * @return
     */
    @Results({
            @Result(id=true,property = "id",column = "id",javaType = Long.class),
            @Result(property="orderNo" ,column="order_no", javaType=String.class),
            @Result(property="createTime", column="create_time", javaType=java.util.Date.class),
    })

    @Select("select * from order_infor  where user_id = #{id}")
    List<OrderBean> findOrderByUID(@Param("id")Long id);

    /**
     * 根据id批量删除用户
     * @param
     * @return
     */
    int delMoreUser( @Param("id")Long id);
}
